package homework.view;


import java.awt.Font;
import java.awt.GridLayout;
import java.awt.TextArea;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

import homework.entity.*;

public class CreateFrame extends JFrame{
    private JLabel l_name;
    private TextArea l_rule;
    private JButton b_send, b_reset,b_add;
    //请完成类的设计
    public CreateFrame(){
    	
        this.setTitle("快递物流平台-后台投递页面");
        setSize(400,500);
    	setLocation(800,200);;
        init();
        this.setVisible(true);

    }
    
    public void init(){
        this.setLayout(null);
        
        Font font = new Font("宋体", Font.PLAIN, 30);
        l_name = new JLabel("包裹登记");
        l_name.setFont(font);
        l_rule = new TextArea("包裹寄件规则如下：\n"
        		+ " 1.距离小于100km，重量小于20公斤，收费10元\r\n"
        		+ "	2.每超过10km，增加1.2元，每超过5公斤，增加1.5元\r\n"
        		+ "	3.加急模式*1.1倍，轻放模式*1.2倍");
        
        b_send = new JButton("新建新包裹");
        b_send.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO 自动生成的方法存根
				new C1Frame();
			}
		});
        
        
        b_add = new JButton("添加新物流信息（旧包裹）");
        b_add.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent e){
                new C2Frame();
            }
        });
        JPanel p = new JPanel();
        p.setLayout(new GridLayout(2,1,5,5));
        p.add(l_name);
        p.add(l_rule);
        p.setBounds(5,5,375,180);
        this.add(p);
        
        p = new JPanel();
        p.setLayout(new GridLayout(1,2,5,5));
        p.add(b_send);
        p.add(b_add);
        p.setBounds(5, 190, 375, 65);
        this.add(p);
        
        
         

	}

}
